irsense6 2.2.0
Loading...
Searching...
No Matches
irsense6.h
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (C) 2020 MikroElektronika d.o.o.
3** Contact: https://www.mikroe.com/contact
4**
5** Permission is hereby granted, free of charge, to any person obtaining a copy
6** of this software and associated documentation files (the "Software"), to deal
7** in the Software without restriction, including without limitation the rights
8** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9** copies of the Software, and to permit persons to whom the Software is
10** furnished to do so, subject to the following conditions:
11** The above copyright notice and this permission notice shall be
12** included in all copies or substantial portions of the Software.
13**
14** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20** USE OR OTHER DEALINGS IN THE SOFTWARE.
21****************************************************************************/
22
27
28#ifndef IRSENSE6_H
29#define IRSENSE6_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
39#ifdef PREINIT_SUPPORTED
40#include "preinit.h"
41#endif
42
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
45 #include "delays.h"
46 #endif
47#endif
48
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
52
58
63
68
73#define IRSENSE6_CMD_FULL_MEASUREMENT 0xAA
74 // irsense6_cmd
76
81
86
91#define IRSENSE6_RAW_DATA_RESOLUTION 0xFFFFFFul
92#define IRSENSE6_OBJ_TEMP_RES 130
93#define IRSENSE6_OBJ_TEMP_OFFSET 20
94#define IRSENSE6_AMB_TEMP_RES 105
95#define IRSENSE6_AMB_TEMP_OFFSET 20
96
102#define IRSENSE6_DEVICE_ADDRESS 0x38
103 // irsense6_set
105
110
115
120#define IRSENSE6_MAP_MIKROBUS( cfg, mikrobus ) \
121 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
122 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
123 cfg.en = MIKROBUS( mikrobus, MIKROBUS_RST );
124 // irsense6_map // irsense6
127
132typedef struct
133{
134 // Output pins
135 digital_out_t en;
136
137 // Modules
138 i2c_master_t i2c;
139
140 // I2C slave address
142
143 uint8_t status;
144
145} irsense6_t;
146
151typedef struct
152{
153 pin_name_t scl;
154 pin_name_t sda;
155
156 pin_name_t en;
157
158 uint32_t i2c_speed;
159 uint8_t i2c_address;
160
162
167typedef enum
168{
171
173
179
190
205
217err_t irsense6_i2c_write ( irsense6_t *ctx, uint8_t *data_in, uint8_t len );
218
230err_t irsense6_i2c_read ( irsense6_t *ctx, uint8_t *data_out, uint8_t len );
231
241
251
263err_t irsense6_read_data ( irsense6_t *ctx, float *obj_temp, float *amb_temp );
264
265#ifdef __cplusplus
266}
267#endif
268#endif // IRSENSE6_H
269 // irsense6
271
272// ------------------------------------------------------------------------ END
err_t irsense6_i2c_read(irsense6_t *ctx, uint8_t *data_out, uint8_t len)
IR Sense 6 I2C read function.
err_t irsense6_init(irsense6_t *ctx, irsense6_cfg_t *cfg)
IR Sense 6 initialization function.
void irsense6_enable_device(irsense6_t *ctx)
IR Sense 6 enable device function.
err_t irsense6_read_data(irsense6_t *ctx, float *obj_temp, float *amb_temp)
IR Sense 6 read temperature data function.
void irsense6_cfg_setup(irsense6_cfg_t *cfg)
IR Sense 6 configuration object setup function.
err_t irsense6_i2c_write(irsense6_t *ctx, uint8_t *data_in, uint8_t len)
IR Sense 6 I2C write function.
void irsense6_disable_device(irsense6_t *ctx)
IR Sense 6 disable device function.
irsense6_return_value_t
IR Sense 6 Click return value data.
Definition irsense6.h:168
@ IRSENSE6_OK
Definition irsense6.h:169
@ IRSENSE6_ERROR
Definition irsense6.h:170
IR Sense 6 Click configuration object.
Definition irsense6.h:152
uint32_t i2c_speed
Definition irsense6.h:158
pin_name_t scl
Definition irsense6.h:153
pin_name_t en
Definition irsense6.h:156
pin_name_t sda
Definition irsense6.h:154
uint8_t i2c_address
Definition irsense6.h:159
IR Sense 6 Click context object.
Definition irsense6.h:133
i2c_master_t i2c
Definition irsense6.h:138
digital_out_t en
Definition irsense6.h:135
uint8_t slave_address
Definition irsense6.h:141
uint8_t status
Definition irsense6.h:143